package org.design.sort;

import lombok.experimental.UtilityClass;

import java.util.ArrayList;
import java.util.List;

/**
 * DataUtils
 *
 * @author 樊温军
 * @date 2025/6/23 下午3:06
 */
@UtilityClass
public class DataUtils {

    /*public int[] getRandomArray() {
        JSONArray jsonArray = JSONUtil.readJSONArray(FileUtil.file
        ("E:\\code\\study\\Java\\design-pattern\\src\\main\\java\\org\\design\\sort\\data.json"), CharsetUtil
        .CHARSET_UTF_8);
        List<Integer> list = jsonArray.toList(Integer.class);
        return list.stream().mapToInt(Integer::intValue).toArray();
    }*/

    public int[] getRandomArray(int size) {
        int[] arr = new int[size];
        for (int i = 0; i < size; i++) {
            arr[i] = (int) (Math.random() * size);
        }
        return arr;
    }

    public List<Integer> getRandomList(int size) {
        List<Integer> arr = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            arr.add((int) (Math.random() * size));
        }
        return arr;
    }
}
